<!DOCTYPE html><html lang="zh-CN"><head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>locale(&apos;x-pseudo&apos;) | Moment.js &#x6587;&#x6863;</title>
  <link rel="stylesheet" href="static/css/style.css">
  <link rel="shortcut icon" href="http://momentjs.cn/static/img/moment-favicon.png">
  <link rel="stylesheet" href="static/css/atom-one-light.min.css">
</head>
<body class="is-moment">
  <div class="hero hero-oneline">
    <div class="hero-centered">
      <h1>locale(&apos;x-pseudo&apos;)</h1>
    </div>
  </div>
  <div id="api-section-__FILENAME__">
    <div id="content" class="clearfix">
  
      <div id="column1" data-id="__ID__" class="interior">
        <header>
          <!-- <h1>locale('x-pseudo')</h1> -->
          <div id="gtoc">
            <ul>
              <!-- <li>v</li> -->
              <li>
                <a href="index.html#/i18n/pseudo-locale/" name="toc">&#x8FD4;&#x56DE;&#x4E0A;&#x5C42;&#x6587;&#x6863;</a>
              </li>
              <li style="border: none;">
                <a href="javascript:window.open('https://github.com/momentjscn/moment-docs-cn/edit/master/moment/06-i18n/09-pseudo-locale.md');" rel="nofollow" target="_blank">&#x63D0;&#x4EA4;&#x4FEE;&#x6539;</a>
              </li>
              <!-- <li>
                <a href="/search__SEARCH_PARAM__" name="toc">搜索</a>
              </li> -->
            </ul>
          </div>
          <hr>
        </header>

        <div id="biz_item"></div>
  
        <div id="apicontent">
          <div id="content_left">
							<div class="docs-method-signature">
								<pre><code class="language-js">moment.locale(&apos;x-pseudo&apos;)
</code></pre>

							</div>
<p>&#x4ECE; <strong>2.13.0</strong> &#x7248;&#x672C;&#x5F00;&#x59CB;&#xFF0C;moment &#x53EF;&#x9009;&#x5730;&#x5305;&#x542B;&#x4F2A;&#x8BED;&#x8A00;&#x73AF;&#x5883;&#x3002;
&#x6B64;&#x8BED;&#x8A00;&#x73AF;&#x5883;&#x5C06;&#x4F1A;&#x4F7F;&#x7528;&#x975E;&#x5E38;&#x660E;&#x663E;&#x53D8;&#x5316;&#x7684;&#x6570;&#x636E;&#x586B;&#x5145;&#x65E5;&#x671F;&#x3002;
&#x4F2A;&#x8BED;&#x8A00;&#x73AF;&#x5883;&#x5728;&#x6D4B;&#x8BD5;&#x65F6;&#x5F88;&#x6709;&#x7528;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x4EEC;&#x53EF;&#x4EE5;&#x6E05;&#x695A;&#x5730;&#x663E;&#x793A;&#x5DF2;&#x5B9A;&#x4F4D;&#x548C;&#x672A;&#x5B9A;&#x4F4D;&#x7684;&#x6570;&#x636E;&#x3002;
&#x53EA;&#x9700;&#x5305;&#x542B;&#x4F2A;&#x8BED;&#x8A00;&#x73AF;&#x5883;&#xFF0C;&#x5E76;&#x5C06; moment &#x7684;&#x8BED;&#x8A00;&#x73AF;&#x5883;&#x8BBE;&#x7F6E;&#x4E3A; x-pseudo&#x3002;
Moment &#x4E2D;&#x7684;&#x6587;&#x672C;&#x5C06;&#x4F1A;&#x975E;&#x5E38;&#x5BB9;&#x6613;&#x53D1;&#x73B0;&#x3002;</p>
<pre><code class="language-javascript">moment.locale(&apos;x-pseudo&apos;);
moment().format(&apos;LLL&apos;); //14 F~&#xE9;br&#xFA;~&#xE1;r&#xFD; 2010 15:25
moment().fromNow(); //&apos;&#xE1; ~f&#xE9;w ~s&#xE9;c&#xF3;~&#xF1;ds &#xE1;~g&#xF3;&apos;
moment().calendar(); //&apos;T~&#xF3;d&#xE1;~&#xFD; &#xE1;t 02:00&apos;
</code></pre>
					</div>
          <div id="content_right">
							<div class="docs-method-signature">
								<pre><code class="language-js">moment.locale(&apos;x-pseudo&apos;)
</code></pre>

							</div>
<p>As of version <strong>2.13.0</strong> moment optionally includes a pseudo locale. This locale will populate the dates with very obviously changed data.
Pseudo locales can be useful when testing, as they make obvious what data has and has not been localized. Just include the pseudo-locale, and set moment&apos;s locale to x-pseudo.
Text from Moment will be very easy to spot.</p>
<pre><code class="language-javascript">moment.locale(&apos;x-pseudo&apos;);
moment().format(&apos;LLL&apos;); //14 F~&#xE9;br&#xFA;~&#xE1;r&#xFD; 2010 15:25
moment().fromNow(); //&apos;&#xE1; ~f&#xE9;w ~s&#xE9;c&#xF3;~&#xF1;ds &#xE1;~g&#xF3;&apos;
moment().calendar(); //&apos;T~&#xF3;d&#xE1;~&#xFD; &#xE1;t 02:00&apos;
</code></pre>
					</div>
          <div></div>
        </div>
      </div>
    </div>
  </div>
  
  <script src="static/js/highlight.min.js"></script>
  <script src="static/js/javascript.min.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>
  <script>var _hmt = _hmt || []; (function () { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?7a7f78c805fbacc7e075d34f153031aa"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();</script>

  <style>
    .hero-centered {
      margin: 0;
          margin-left: 10px;
    }
#gtoc ul {
  list-style: none;
  margin-left: 0;
  line-height: 1.5rem;
  padding: 0;
}
#gtoc>ul>li {
  display: inline;
  border-right: 1px solid #000;
  margin-right: .4rem;
  padding-right: .4rem;
}
#gtoc>ul>li>a {
  color: #61b2a7;
}
#content_left {
  width: 49%;float: left;border-right: 1px solid #eee;    padding-right: 2%;
}
#content_right {
float: left;width: 48%;margin-left: 3%;
}
#column1 {
  padding: 0 2rem;
}
  </style>


</body></html>